<?php
    include_once 'xmlrpc.inc';
	class Authentication {
		private $auth_req;
		private $client_req;
		private $token_string;
		public function __construct() {
			$this->auth_req = new xmlrpcmsg('autenticazione.Accedi',   array(new xmlrpcval("rmob-vu8l53X71qnUqOF", "string"), new xmlrpcval("", "string")));
			$this->client_req= new xmlrpc_client("http://muovi.roma.it/ws/xml/autenticazione/1");
		} 
		public function requestToken() {
			$result=$this->client_req->send($this->auth_req);
			if(!$result->faultCode())
        		{
                		$token_id = $result->value();
                		$this->token_string = $token_id->scalarVal();
		  	}	
			else
			{	
				throw new Exception("Errore richiesta token<br />");
			}
		}
		public function getToken() {
			return $this->token_string;
		}
	}
?>
